/**
 *
 */
Ext.define('vacake.view.Login', {
    extend: 'Ext.form.Panel',
    xtype: 'loginForm',
    requires: [
            'Ext.form.Panel',
            'Ext.form.FieldSet',
            'Ext.field.Password'
    ],
    config: {
        scrollable: {
            direction: 'vertical',
            directionLock: false
        },
        layout: 'vbox',
        items: [{
                docked: 'top',
                xtype: 'titlebar',
                title: '登录',
                items: [{
                        text: '返回',
                        action: 'login_back_parent',
                        ui: 'action-back'
                    }
                ]
            }, {
                margin: '20px auto 0px auto',
                xtype: 'image',
                src: 'resources/images/project_logo.png',
                height: 103,
                width: 194
            }, {
                cls: 'fenge'
            }, {
                xtype: 'fieldset',
                id: 'login_field',
                items: [{
                        xtype: 'textfield',
                        name: 'name',
                        id: 'login_name',
                        placeHolder: '手机号',
                        autoCapitalize: true,
                        required: true
                    }, {
                        xtype: 'passwordfield',
                        name: 'password',
                        id: 'login_password',
                        placeHolder: '密  码'
                    }, {
                        xtype: 'hiddenfield',
                        name: 'caid',
                        id: 'login_caid'
                    }, {
                        xtype: 'hiddenfield',
                        name: 'areaId',
                        id: 'login_areaId'
                    }
                ]
            }, {
                xtype: 'fieldset',
                items: [{
                        xtype: 'checkboxfield',
                        name: 'showPassword',
                        style: 'padding:0 0 10px 5px;',
                        id: 'showPassword',
                        label: '显示密码'

                    }, {
                        xtype: 'button',
                        ui: 'confirm',
                        text: '登陆',
                        action: 'loginSubmit'
                    }
                ]
            }, {
                xtype: 'fieldset',
            style:'padding:0 8px 0 6px ',
                layout: {
                    type: 'hbox',
                    align: 'middle',
                    pack: 'center'
                },
                items: [{
                        xtype: 'button',
                        text: '找回密码',
                        action: 'forgetPassword',
                        width: '49%',
                        margin:'0 1% 0 0 '
                    }, {
                        xtype: 'button',
                        text: '注册',
                        //cls: 'x-button2',
                        //ui: 'confirm',
                        width: '49%',
                        margin:'0 0 0 1% ',
                        action: 'registerLoad'
                    }
                ]
            }
        ],
        listeners: {
            initialize: function() {
                Ext.getCmp('login_name').setValue('')
                Ext.getCmp('login_password').setValue('')
                Ext.getCmp('login_caid').setValue('')
                Ext.getCmp('login_areaId').setValue('')
            },
            painted: function() {
                Ext.Viewport.unmask();
            },
            back: function() {
                var backid = Ext.Viewport.getInnerItems().length - 2;
                Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
                Ext.Viewport.setActiveItem(backid);
            }
        }
    }

});